package y24.m4;

public class Test18 {
    public static void moveZeroes(int[] nums){
        int size = nums.length;
        int left = 0;
        int right = 0;
        if (nums != null && size > 0){
            int zeroe = 0;
            while (right < size){
                if (nums[right] == 0 && zeroe == 0){
                    left = right;
                    zeroe++;
                } else{
                    nums[left] = nums[right];
                    left = right;
                }
                right++;
            }
            while (right-zeroe < size){
                nums[right-zeroe] = 0;
                right++;
            }
        }

    }

    public static void main(String[] args) {
        int[] nums = {0,1,0,3,12};
        moveZeroes(nums);
    }
}
